package com.zut.wx.handler;

import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class SubscribeMsgHandler implements WxChatMsgHandle{
    @Override
    public WxChatMsgTypeEnums getEnumByType() {

        return WxChatMsgTypeEnums.SUBSCRIBE;
    }

    @Override
    public String dealMsg(Map<String, String> mapMsg) {
        //对关注公众号的逻辑处理
        String fromUserName = mapMsg.get("FromUserName");
        String toUserName = mapMsg.get("ToUserName");
        String data="你好呀，欢迎关注！";
        String text="<xml>\n" +
                "  <ToUserName><![CDATA["+fromUserName+"]]></ToUserName>\n" +
               "  <FromUserName><![CDATA["+toUserName+"]]></FromUserName>\n" +
               "  <CreateTime>12345678</CreateTime>\n" +
              "  <MsgType><![CDATA[text]]></MsgType>\n" +
              "  <Content><![CDATA["+data+"]]></Content>\n" +
              "</xml>";
        return text;
    }
}
